#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void){
    int a, b, c, d;
    int x;

    srand(time(NULL));

    a = rand() % 100;
    b = rand() % 100;
    c = rand() % 100;
    d = rand() % 100;

    time_t s = time(NULL);

    do {

        putchar('\n');

        printf("%d + %d + %d + %d = ", a, b ,c ,d);
        scanf("%d", &x);

        if (x == a + b + c + d) {
            break;
        }

        printf("回答错误,请重新输入!\n");

    } while (1);

    printf("use %.2f s. \n", difftime(time(NULL), s));

}


